package com.example.auto.inventory.system;

import java.util.ArrayList;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.StrictMode;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;

public class MainActivity extends Activity implements OnClickListener {
	Button btnadd, btnout, btnscheduler, btnsecurity;

	ListView list;
	ArrayList<String> data;
	ArrayAdapter<String> adapter;
	Context con;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		DB.act = this;

		StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
				.permitAll().build();
		StrictMode.setThreadPolicy(policy);

		btnadd = (Button) findViewById(R.id.btnadd);
		btnout = (Button) findViewById(R.id.btnout);
		btnscheduler = (Button) findViewById(R.id.btnscheduler);
		btnsecurity = (Button) findViewById(R.id.btnsecurity);

		btnadd.setOnClickListener(this);
		btnout.setOnClickListener(this);
		btnscheduler.setOnClickListener(this);
		btnsecurity.setOnClickListener(this);
		
		new Thread(new Runnable(){

			public void run() {
				while(true){
					DB.getSecurity();
				}				
			}
			
		}).start();

	}

	public void onClick(View v) {
		Intent intent = null;
		switch (v.getId()) {
		case R.id.btnadd:
			intent = new Intent(this, launch_activity1.class);
			break;

		case R.id.btnout:
			intent = new Intent(this, launch_activity2.class);
			break;

		case R.id.btnscheduler:
			intent = new Intent(this, launch_activity3.class);
			break;

		case R.id.btnsecurity:
			intent = new Intent(this, launch_activity4.class);
			break;
		}

		startActivity(intent);
	}
}
